﻿using System;
using System.Collections.Generic;
using System.Text;
using ZProjectNamespaceNameZ.ZSafeParentProjectNameZ;
using System.Data;

namespace ZSafeProjectNameZ.Tests.Mocks
{
    public static class MockHelper
    {
        public const int ModuleId = 321;
        public const int ValidModuleId = 1;
        public const int ValidZParentProjectNameZInfoId = 1;
        public const int NullZParentProjectNameZInfoId = 0;
        public const int LoadExceptionId = -2;
        public const int AddExceptionId = -3;
        public const int UpdateExceptionId = -4;
        public const int DeleteExceptionId = -5;

        public const string content = "Content";
        public const string updateContent = "Updated Content";
        public const string createdByUserName = "User 1";
        public const int createdByUser = 1;
        public const int createdDateYear = 2008;
        public const int createdDateMonth = 1;
        public const int createdDateDay = 1;

        public static ZParentProjectNameZInfo CreateZParentProjectNameZInfo()
        {
            ZParentProjectNameZInfo ZParentProjectNameZInfo = new ZParentProjectNameZInfo()
            {
                Content = MockHelper.content,
                CreatedByUser = MockHelper.createdByUser,
                CreatedByUserName = MockHelper.createdByUserName,
                CreatedDate = new DateTime(MockHelper.createdDateYear, MockHelper.createdDateMonth, MockHelper.createdDateDay),
                ItemId = 1,
                ModuleId = ModuleId
            }; 
            return ZParentProjectNameZInfo;
        }

        public static IDataReader CreateTestDrivenModuleDataReader()
        {
            DataTable datatable = new DataTable();
            datatable.Columns.Add("ModuleId");
            datatable.Columns.Add("ItemId");
            datatable.Columns.Add("Content");
            datatable.Columns.Add("CreatedByUser");
            datatable.Columns.Add("CreatedDate");
            datatable.Columns.Add("CreatedByUserName");

            datatable.Rows.Add(ModuleId, ValidZParentProjectNameZInfoId, content, createdByUser, new DateTime(createdDateYear, createdDateMonth, createdDateDay), createdByUserName);

            return datatable.CreateDataReader();

        }

        public static IDataReader CreateTestDrivenModuleDataReader2Rows()
        {
            DataTable datatable = new DataTable();
            datatable.Columns.Add("ModuleId");
            datatable.Columns.Add("ItemId");
            datatable.Columns.Add("Content");
            datatable.Columns.Add("CreatedByUser");
            datatable.Columns.Add("CreatedDate");
            datatable.Columns.Add("CreatedByUserName");

            datatable.Rows.Add(ModuleId, ValidZParentProjectNameZInfoId, content, createdByUser, new DateTime(createdDateYear, createdDateMonth, createdDateDay), createdByUserName);
            datatable.Rows.Add(ModuleId, ValidZParentProjectNameZInfoId, content, createdByUser, new DateTime(createdDateYear, createdDateMonth, createdDateDay), createdByUserName);

            return datatable.CreateDataReader();

        }

    }
}
